import { TRoute } from '../interface'
import { auth } from './utils'

/** OMS 路由表，集中统一配置，路由地址使用首字母小写驼峰命名法 */
export const bizOms: TRoute<true, '/biz/'>[] = [
  {
    path: '/biz/trackOrder/list',
    handle: { name: () => '运单列表' },
    lazy: async () => {
      const { List } = await import('@oBiz/TrackOrder')
      return { element: auth(<List />, ['1']) }
    },
    children: [
      {
        path: '/biz/trackOrder/list/detail/:waybillNo',
        handle: { name: () => '运单详情' },
        lazy: async () => {
          const { Detail } = await import('@oBiz/TrackOrder')
          return { element: auth(<Detail />, ['1']) }
        },
      },
    ],
  },
  {
    path: '/biz/trackOrder/list/detail',
    handle: { name: () => '运单详情' },
    lazy: async () => {
      const { Detail } = await import('@oBiz/TrackOrder')
      return { element: auth(<Detail />, ['1']) }
    },
  },
  {
    path: '/biz/trackManage/list',
    handle: { name: () => '追踪列表' },
    lazy: async () => {
      const { List } = await import('@oBiz/TrackManage/List')
      return { element: auth(<List />, ['1']) }
    },
    children: [
      {
        path: '/biz/trackManage/list/detail/:waybillNo',
        handle: { name: () => '追踪详情' },
        lazy: async () => {
          const { Detail } = await import('@oBiz/TrackManage/Detail')
          return { element: auth(<Detail />, ['1']) }
        },
      },
    ],
  },
  {
    path: '/biz/trackManage/eventList',
    handle: { name: () => '轨迹列表' },
    lazy: async () => {
      const { EventList } = await import('@oBiz/TrackManage/EventList')
      return { element: auth(<EventList />, ['1']) }
    },
  },
  {
    path: '/biz/trackManage/eventTemplate',
    handle: { name: () => '轨迹模板' },
    lazy: async () => {
      const { EventTemplate } = await import('@oBiz/TrackManage/EventTemplate')
      return { element: auth(<EventTemplate />, ['1']) }
    },
  },
]
